package com.zzyl.config;

import com.aliyun.iot20180120.Client;
import com.aliyun.teaopenapi.models.Config;
import com.zzyl.properties.AliyunIotProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class AliyunIotConfig {

    /**
     * LTAI5tDQKg9F61aJhbmhqVRK
     * LYUKZH7HQGBoD025pmSq0fQsREaOYD
     * @return
     * @throws Exception
     */
    @Bean
    public Client instance(AliyunIotProperties aliyunIotProperties) throws Exception {
        Config config = new Config();
        config.setAccessKeyId(aliyunIotProperties.getAccessKeyId());
        config.setAccessKeySecret(aliyunIotProperties.getAccessKeySecret());
        config.setRegionId(aliyunIotProperties.getRegionId());
        return new Client(config);
    }
}
